<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
	<head>
        <jsp:include page="../inc_bootstrap.jsp"></jsp:include>
		<jsp:include page="../head.jsp"/>
		<title>商家管理-账户佣金账期配置</title>
		<link rel="stylesheet" href="${ctx}/css/iconfont.css"/>
		<script type="text/javascript">
		$(function(){
                //先销毁表格
                $('#bootTable').bootstrapTable({
                    url: '${ctx}/charges/getSupplierList?temp='+Math.random(),
                    dataType: "json",
                    method: 'get',
                    cache: false,
                    height: "auto",//
                    striped: true,
                    pagination: true,
                    pageSize: 20,
                    pageNumber:1,
                    pageList: [10, 20, 50, 100, 200, 500],
                    search: true,
                    showColumns: true,
                    showRefresh: true,
                    clickToSelect: true,
                    idField:'id',
                    //toolbar: "#toolbar",
                    paginationHAlign: 'left',
                    paginationDetailHAlign: 'right',
                    sidePagination: "server", //表示服务端请求
                    queryParamsType : "undefined",
                    columns: [
                        {field:"id",title:"",align:"center",valign:"middle",sortable:"true",visible:false},
                        {field:"supplierName",title:"供应商",align:"center",valign:"middle"},
                        {field:"rate",title:"佣金率",align:"center",valign:"middle"},
                        {field:"creditOrver",title:"账期终点",align:"center",valign:"middle",
                            formatter: function(value, row, index) {
                                return CommonConverter.toEmptyString(row.creditOrver);
                            }
                        },
                        {field:"creditTime",title:"账期时长（天）",align:"center",valign:"middle",
                            formatter: function(value, row, index) {
                                return CommonConverter.toEmptyString(row.creditTime);
                            }
                        },
                        {field:"status",title:"操作",align:"center",valign:"middle",
                            formatter: function(value, row, index) {
                                var paymentTime=CommonConverter.toEmptyString(row.paymentOverTime);
                                //var str = '<div class="autoBoxTwo"><span class="mynewBtn" onclick=Editor("'+row.id+'")>编辑</span></div>';
                                var str ='<i class="icon iconfont" title="编辑" onclick=Editor("'+row.id+'")>&#xe601;</i>';
                                return str;
                            }
                        }
                    ],
                    formatNoMatches: function(){
                        return '无符合条件的记录';
                    }
                });
	});
	
		//编辑
		function Editor(id){
			// alert(id);
			layer.open({
				type: 2,
				title: ['佣金配置','background-color:#00B2EE; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				yes: function(index, layero) {
					layer.close(index);
				},
				btn2: function(index, layero) {
					//取消的回调
				},
				area: ['600px', '400px'],  
				content: ['${ctx}/np/editCharges?id='+id],  //iframe的url，no代表不显示滚动条
				success: function(layero, index){
					 // layer.full(index);
				},
				end:function(){
                    $('#bootTable').bootstrapTable('refresh',{url: '${ctx}/charges/getSupplierList?temp='+Math.random()});
				}
			});
		}
		
		</script>
	</head>
	<body style="padding-left:10px;" >
		<div class="divBox">
            <table id="bootTable" class="table-striped"></table>
		</div>
	<jsp:include page="../footer.jsp"/>
</body>
</html>